<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
<div v-if="!is">
  <a href="javascript:void(0)">注册</a>
  <!--如果超链接点击时 不离开此页面 需要废掉href跳转功能
   添加javascript:void(0)-->
  <a href="javascript:void(0)" @click="is=true">登录</a>
</div>
<div v-else>
  <input type="text" v-model="name">
  <input type="button" value="登录"  @click="f()">
  <a href="javascript:void(0)" @click="is=false">登出</a>
</div>
  <ul>
    <li v-for="name in arr">{{name}}</li>
  </ul>

</div>
<script src="../js/vue.js"></script>
<script>
  let v =new Vue({
            el:"body>div",
            data:{
              /*isVisible显示的意思*/
              is:false,
              name:"",
              arr:["张飞","关羽"]
            },
            methods:{
              f(){
                v.arr.push(name=v.name);
                v.name="";
              }

            }
          })
</script>
</body>
</html>